| Conditions | 1 |
| Paths | 1 |
| Total Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /* global jest, it, describe, expect */ |
||
| 8 | describe('CentProvider', () => { |
||
| 9 | const config = {url: 'http://localhost:8000/connect', insecure: true} |
||
| 10 | |||
| 11 | it('should throw Exception if the `url` ' + |
||
| 12 | 'is not provided in the configuration', () => { |
||
| 13 | expect(() => { CentProvider({}) }).toThrow() |
||
| 14 | }) |
||
| 15 | |||
| 16 | it('should provide `cent` context', () => { |
||
| 17 | const wrapper = new CentProvider({config}) |
||
| 18 | expect(wrapper.getChildContext().cent.constructor.name).toBe('CentManager') |
||
| 19 | expect(CentProvider.childContextTypes.cent).toBe(PropTypes.object.isRequired) |
||
| 20 | }) |
||
| 21 | |||
| 22 | it('should render children', () => { |
||
| 23 | const div = React.createFactory('div') |
||
| 24 | const children = React.createElement(div) |
||
| 25 | const wrapper = new CentProvider({config, children}) |
||
| 26 | const render = wrapper.render() |
||
| 27 | expect(render).toBe(children) |
||
| 28 | }) |
||
| 29 | |||
| 30 | it('should have children proptype required', () => { |
||
| 31 | expect(CentProvider.propTypes.children).toBe(PropTypes.element.isRequired) |
||
| 32 | }) |
||
| 33 | }) |
||
| 34 |